<?php
/**
 * Created by PhpStorm.
 * User: dell
 * Date: 2017/6/9
 * Time: 10:25
 */

namespace Admin\Model;

use Think\Model;

class QrCodeModel extends Model{
    protected $tableName = "qr_code";

    public function QrCodeList(){
        $res = $this
            ->where("is_delete != 1")
            ->select();
        if(false !== $res){
            return $res;
        }
    }
    public function QrCodeAdd($data){
        $data['created_time'] = time();
        return $this->add($data);
    }

    public function QrCodeFind($id){
        if(!$id)return;
        $res = M("qr_code as q")
            ->where("q.id = %d",$id)
            ->find();
        return $res;
    }
    public function QrCodeEdit(){
        $this->create();
        return $this->save();
    }
    public function QrCodeDel($id){
        if(!$id)return;
        return $this->where("id = %d",$id)->save(['is_delete'=>1]);
    }
}